﻿
@{
    WebSecurity.RequireAuthenticatedUser();
    Layout = "~/_SiteLayout.cshtml";
    Page.Title = "Reference Data Manager";
    
    var db = Database.Open("CCMS");
    var queryRefType = db.Query("select RefTypeCode, RefTypeDesc from ReferenceType order by RefTypeDesc");

}

<style type="text/css">
* { font-family: Verdana; font-size: 96%; }
label { width: 15em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
</style>

<script>
    
     $(function(){
        
        $("#buttonNew").hide();
        wireEvents();
      
      
    });
   
    

     function wireEvents(){
        $("#search").click(function(){
      //  $("#searchForm").attr("action","/Maintenance/Index/search");
        
        var ref1 = $("#refid").val();
        var ref2 = $("#reftype").val();
        var ref3 = $("#desc").val();
        var ref4 = $("#active").val();
        loadCCList(ref1, ref2, ref3, ref4); 
         $("#buttonNew").show();
        
   
         });
        
        $(document).ready(function() {            
            $('#clear').click(function() {                
                location.reload();            });        }); 
         
            showSpinner();
        }
     
    function loadCCList(param1,param2,param3,param4){
     var dummy = new Date().getTime();
    $("#grid").empty();
    $.post("/Maintenance/SearchDataGrid?RefId="+ param1 +"&RefType="+param2+"&RefDesc="+param3+"&Active="+param4,function(data){
        $("#grid").html(data); 
    });
    

   
}

 
        
</script>
 
 <form id="searchForm" method="post"  class="ui-widget" >
 <div id="spinner" class="spinnerContent" style="display:none;border:1px solid black">
                    <img id="img-spinner" src="@Href("/images/ajax-loader.gif")" alt="Loading"/>
                    <p>Searching reference data please wait...</p>
                </div>
                <div id="spinnerBG"></div>   
        <fieldset class="ui-widget ui-widget-content">
        <p><label for="reftype">REFERENCE TYPE </label><select name="reftype" id="reftype">
                @foreach(var reftype in queryRefType){
                    <option value="@reftype.RefTypeCode">@reftype.RefTypeDesc</option>
                }
        </select></p>
       <p>
        <label for="refid">REFERENCE ID </label><input type="text" name="refid" id="refid"/>
        </p>
    <p>
        <label for="desc">DESCRIPTION </label><input type="text" name="desc" id="desc"/>
       </p>
    <p>
       <label for="pbcode">PARTNER BANK CODE </label><input type="text" name="pbcode" />
        </p>
            <p><label for="active">
        ACTIVE (Y/N) </label><select name="active" id="active"><option value="1">Y</option>
        <option value="0">N</option></select>
        </p>
    <div id="buttons">
        <input type="button" id="search" value="search"/>
        <input type="button" id="clear" value="clear"/>
    </div>
     </fieldset>
    <div id="grid">
                
    </div>
    <p id="buttonNew"><input type="button" id="button2" value="New"/></p>
</form>
   
